package com.general.framework.core.enums;

import com.general.framework.core.lang.Strings;

import java.util.Objects;

/**
 * 通用状态(0启用,1停用)
 */
public enum StatusEnum implements IEnum<Integer>{

    normal(1, "启用"),
    disable(0, "停用");

    private Integer value;

    private String desc;

    StatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Integer value) {
        for (StatusEnum thisEnum : StatusEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
